import { RouteRecordRaw } from 'vue-router';

// 主框架内显示的路由
export const frameIn: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/main',
  },
  {
    path: '/main',
    name: 'Main',
    component: () => import('@/views/main/index.vue'),
    meta: {
      title: '主页',
      auth: true,
    },
    children: [
      {
        path: '/setting/user',
        name: 'User',
        component: () => import('@/views/setting/user/index.vue'),
        meta: {
          title: '用户管理',
          auth: true,
        },
      },
      {
        path: '/setting/role',
        name: 'Role',
        component: () => import('@/views/setting/role/index.vue'),
        meta: {
          title: '角色管理',
          auth: true,
        },
      },
      {
        path: '/setting/permission',
        name: 'Permission',
        component: () => import('@/views/setting/permission/index.vue'),
        meta: {
          title: '权限管理',
          auth: true,
        },
      },
      {
        path: '/log/operation',
        name: 'OptLog',
        component: () => import('@/views/log/operation/index.vue'),
        meta: {
          title: '操作日志',
          auth: true,
        },
      },
      {
        path: '/log/entry',
        name: 'EntryLog',
        component: () => import('@/views/log/entry/index.vue'),
        meta: {
          title: '登录日志',
          auth: true,
        },
      },
      {
        path: '/book',
        name: 'Book',
        component: () => import('@/views/book/index.vue'),
        meta: {
          title: '礼簿管理',
          auth: true,
        },
      },
    ],
  },
];

// 主框架外显示的路由
const frameOut = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '登录',
      auth: false,
    },
  },
];

// 单点登录
const ssoPage = [
  {
    path: '/sso_login',
    name: 'Sso',
    component: () => import('@/views/sso/index.vue'),
    meta: {
      title: '登录',
      auth: false,
    },
  },
];

const errorPage = [
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('@/views/sys/error/404.vue'),
    meta: {
      title: '404',
      auth: false,
    },
  },
];

export default [...frameIn, ...frameOut, ...errorPage, ...ssoPage];
